<!DOCTYPE html>
<html>
<head>

<meta name="viewport" content="width=800">
<style>
html { font-size: 16px; }
body { width: 800px; margin: 0; overflow-y: hidden; }
</style>

<script src="resources/autosizingTest.js"></script>

</head>
<body>
<script>

function enableAutosizing(enabled) {
    if (window.internals)
        internals.settings.setTextAutosizingEnabled(enabled);
}

function addCluster() {
    var cluster = '<table><tr><td>' +
            'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut' +
            'labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco' +
            'laboris ni si ut aliquip ex ea commodo consequat.' +
        '</td></tr></table>';
    document.body.innerHTML += cluster;
}

function removeCluster() {
    var tables = document.getElementsByTagName('table');
    if (tables.length)
        tables[tables.length - 1].parentElement.removeChild(tables[tables.length - 1]);
}

addCluster();
addCluster();
var forceLayout1 = document.body.offsetTop;
enableAutosizing(false);
removeCluster();
removeCluster();
var forceLayout2 = document.body.offsetTop;
enableAutosizing(true);
addCluster();
var forceLayout3 = document.body.offsetTop;
document.body.innerHTML = "PASS";

if (window.testRunner)
    testRunner.dumpAsText();
</script>
</body>
</html>
